<!-- 活跃用户 -->
<template>
    <div class="data-number">
      <div class="bg-box" :style="color | formatBg"></div>
      <div class="content-box">
        <div class="header flexbox color-f f14">
          {{label}}
        </div>
        <div class="number flexbox color-f f32">{{total | formatNumber}}</div>
      </div>
    </div>
</template>

<script>

export default {
  name: "dataNumber",
  props: {
    label: String,
    color: String,
     // 总数
    total: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      isChrome: false
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
    })
  },
  components: {

  },
  filters: {
    formatBg(color){
      switch(color){
        case '1':
          return 'background: linear-gradient(0deg, #3975FF 0%, #7C9CFF 100%)'
          break;
        case '2':
          return 'background: linear-gradient(0deg, #6157FF 0%, #A09EF3 100%)'
          break;
        case '3':
          return 'background: linear-gradient(0deg, #079FD4 0%, #51DBF3 100%)'
          break;
        case '4':
          return 'background: linear-gradient(-180deg, #DB75DD 0%, #8567E6 100%)'
          break;
      }
    },
    formatNumber(number){
      return Math.round(number)
    }
  },
  computed: {
    
  },
  watch:{
    
  },
  methods: {
    
  },
};
</script>

<style lang="scss">
  .data-number {
    position: relative;
    width: 247px;
    height: 120px;
    margin-bottom:20px;
    margin-right:20px;
    *{
      position: relative;
    }
    .bg-box {
      // opacity: .6;
      position: absolute;
      top: 0;
      left: 0;
      border-radius: 4px;
      width: 100%;
      height: 100%;
    }
    .content-box {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      padding: 15px 0 0 15px;
      box-sizing: border-box;
      .header{
        text-shadow: 0 0 1p rgba(0,0,0,0.8);
      }
      .number{
        font-family: 'FUTURAB';
        text-shadow: 0 0 1p rgba(0,0,0,0.8);
      }
    }
    .f32 {
      font-size: 32px;
      -webkit-text-size-adjust:none;
    }
  }
  

</style>
